package controller

import (
	"net/http"

	"github.com/gin-gonic/gin"

	"gin-scaffold/params"
	"gin-scaffold/service"
)

func LoginHandler(c *gin.Context) {
	// 1. 参数处理
	var login params.Login
	err := c.ShouldBind(&login)
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{"code": 1, "msg": "wrong params"})
		return
	}
	// 2. 业务逻辑
	service.Login()
	// 3. 返回响应
	c.JSON(http.StatusOK, gin.H{"code": 0, "msg": "login success"})
}
